package 数学问题;

import java.util.Scanner;

public class Nim游戏 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = scanner.nextInt();
        }
        System.out.println(solve(a));
    }
    static boolean solve(int[] A){
        int res = 0;
        for (int i = 0; i < A.length; i++) {
            res = res^A[i];
        }
        return res != 0;
    }
}
